YNQ  YNQ-1.5.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Cryptographic

Data Structures

struct  CMCrypterList
 

Typedefs

typedef void(* CMAbstractHasher )(const NQ_BYTE *dataIn, NQ_BYTE *dataOut, NQ_COUNT length)
 
typedef void(* CMAbstractCipher )(const CMBlob *key, const CMBlob *key1, const CMIOBlob dataFragments[], NQ_COUNT numFragments, NQ_BYTE *buffer, NQ_COUNT bufferSize)
 
typedef void(* CMAbstractIOCipher )(const CMBlob *key, const CMBlob *key1, const CMIOBlob dataFragments[], NQ_COUNT numFragments, NQ_BYTE *buffer, NQ_COUNT bufferSize)
 
typedef void(* CMAbstractHasher512 )(const CMBlob *key, const CMBlob *key1, const CMIOBlob dataFragments[], NQ_COUNT numFragments, NQ_IOBufPos buffer, NQ_COUNT bufferSize, NQ_BYTE *ctxBuff)
 
typedef void(* CMAbstractCcmEncryption )(const CMBlob *key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, NQ_BYTE *auth)
 
typedef NQ_BOOL(* CMAbstractCcmDecryption )(const CMBlob *key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, const NQ_BYTE *auth)
 
typedef void(* CMAbstractGcmEncryption )(const CMBlob *key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, NQ_BYTE *auth, NQ_BYTE *keyBuffer, NQ_BYTE *encMsgBuffer)
 
typedef NQ_BOOL(* CMAbstractGcmDecryption )(const CMBlob *key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, const NQ_BYTE *auth, NQ_BYTE *keyBuffer, NQ_BYTE *msgBuffer)
 

Functions

void cmSetExternalCrypters (const CMCrypterList *crypters)
 
void cmResetExternalCrypters (void)
 

Detailed Description

Typedef Documentation

typedef void(* CMAbstractHasher)(const NQ_BYTE *dataIn, NQ_BYTE *dataOut, NQ_COUNT length)

This function prototype designates an abstract cryptographic hash algorithm. It is used to replace internal NQ encryption with an external one.

Parameters
dataInPointer to the data to encrypt.
dataOutPointer to the buffer for encrypted.
lengthLength of the incoming data and also the length of the encrypted data.
typedef void(* CMAbstractCipher)(const CMBlob *key, const CMBlob *key1, const CMIOBlob dataFragments[], NQ_COUNT numFragments, NQ_BYTE *buffer, NQ_COUNT bufferSize)

This function prototype designates an abstract cryptographic algorithm using a cryptographic key. It is used to replace internal NQ encryption with an external one.

Parameters
keyPointer to the encryption key descriptor. Some algorithms do not use this value.
key1Pointer to the auxiliary key descriptor. This value may be NULL. Also the data pointer may be null as well as the blob length may be zero. In either of those cases the auxiliary key is ignored. Some algorithms may ignore this value anyway.
dataFragmentsA pointer to the array of data fragment descriptors. For encryption algorithms which allow encrypting multiple fragments, this array may contain more than one element. For other algorithms, only the first element is used. An element may be NULL. Also a data pointer in an element may be NULL as well as blob length may be zero. In either of those cases the respective fragment is ignored.
numFragmentsNumber of data fragments (see above).
bufferPlace holder for hash result.
bufferSizeThe expected length of the encrypted data
typedef void(* CMAbstractIOCipher)(const CMBlob *key, const CMBlob *key1, const CMIOBlob dataFragments[], NQ_COUNT numFragments, NQ_BYTE *buffer, NQ_COUNT bufferSize)

This function prototype designates an abstract cryptographic algorithm using a cryptographic key. It is used to replace internal NQ encryption with an external one.

Parameters
keyPointer to the encryption key descriptor. Some algorithms do not use this value.
key1Pointer to the auxiliary key descriptor. This value may be NULL. Also the data pointer may be null as well as the blob length may be zero. In either of those cases the auxiliary key is ignored. Some algorithms may ignore this value anyway.
dataFragmentsA pointer to the array of data fragment descriptors. For encryption algorithms which allow encrypting multiple fragments, this array may contain more than one element. For other algorithms, only the first element is used. An element may be NULL. Also a data pointer in an element may be NULL as well as blob length may be zero. In either of those cases the respective fragment is ignored.
numFragmentsNumber of data fragments (see above).
bufferPlace holder for hash result.
bufferSizeThe expected length of the encrypted data
typedef void(* CMAbstractHasher512)(const CMBlob *key, const CMBlob *key1, const CMIOBlob dataFragments[], NQ_COUNT numFragments, NQ_IOBufPos buffer, NQ_COUNT bufferSize, NQ_BYTE *ctxBuff)

This function prototype designates an abstract cryptographic algorithm for both encryption and producing authentication data (CCM) . It is used to replace internal NQ encryption with an external one.

This algorithm assumes that there are two blocks of data:

  1. A prefix that is preserved as is
  2. The messages itself that is to be encrypted The authentication is a production of both blocks.
    Parameters
    keyPointer to the encryption key descriptor. Some algorithms do not use this value.
    key1Pointer to the auxiliary key descriptor. This value may be NULL. Also the data pointer may be null as well as the blob length may be zero. In either of those cases the auxiliary key is ignored. Some algorithms may ignore this value anyway.
    prefixA pointer to the message prefix descriptor. This data participate in authentication but remains as is, without encryption.
    messagePointer to the message descriptor. This message will be encrypted in-place.
    authPointer to the authentication data. It will be filled as the result of the algorithm.
typedef void(* CMAbstractCcmEncryption)(const CMBlob *key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, NQ_BYTE *auth)

This function prototype designates an abstract cryptographic algorithm for producing authentication data. It is used to replace internal NQ encryption with an external one. The authentication (hash result) is a product of all data blocks.

Parameters
keyPointer to the encryption key descriptor. Some algorithms do not use this value.
key1Pointer to the auxiliary key descriptor. This value may be NULL. Also the data pointer may be null as well as the blob length may be zero. In either of those cases the auxiliary key is ignored. Some algorithms may ignore this value anyway.
dataFragmentsA pointer to the array of data fragment descriptors. For encryption algorithms which allow encrypting multiple fragments, this array may contain more than one element. For other algorithms, only the first element is used. An element may be NULL. Also a data pointer in an element may be NULL as well as blob length may be zero. In either of those cases the respective fragment is ignored.
numFragmentsNumber of data fragments (see above).
bufferPlace holder for hash result.
bufferSizeThe expected length of the encrypted data
ctxBuffBuffer for context data. if this buffer is null, context buffer will be allocated in function.
typedef NQ_BOOL(* CMAbstractCcmDecryption)(const CMBlob *key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, const NQ_BYTE *auth)

This function prototype designates an abstract cryptographic algorithm for both decryption and authentication (CCM) . It is used to replace internal NQ encryption with an external one.

This algorithm assumes that there are two blocks of data:

  1. A prefix that is preserved as is
  2. The messages itself that is to be encrypted The authentication is a production of both blocks.
Parameters
keyPointer to the encryption key descriptor. Some algorithms do not use this value.
key1Pointer to the auxiliary key descriptor. This value may be NULL. Also the data pointer may be null as well as the blob length may be zero. In either of those cases the auxiliary key is ignored. Some algorithms may ignore this value anyway.
prefixA pointer to the message prefix descriptor. This data participate in authentication but remains as is, without encryption.
messagePointer to the message descriptor. This message will be encrypted in-place.
authPointer to the authentication data. This value is be used to authenticate.
Returns
TRUE if authenticated, FALSE if not.
typedef void(* CMAbstractGcmEncryption)(const CMBlob *key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, NQ_BYTE *auth, NQ_BYTE *keyBuffer, NQ_BYTE *encMsgBuffer)

This function prototype designates an abstract cryptographic algorithm for both encryption and producing authentication data (GCM) . It is used to replace internal NQ encryption with an external one.

This algorithm assumes that there are two blocks of data:

  1. A prefix that is preserved as is
  2. The messages itself that is to be encrypted The authentication is a production of both blocks.
    Parameters
    keyPointer to the encryption key descriptor. Some algorithms do not use this value.
    key1Pointer to the auxiliary key descriptor. This value may be NULL. Also the data pointer may be null as well as the blob length may be zero. In either of those cases the auxiliary key is ignored. Some algorithms may ignore this value anyway.
    prefixA pointer to the message prefix descriptor. This data participate in authentication but remains as is, without encryption.
    messagePointer to the message descriptor. This message will be encrypted in-place.
    authPointer to the authentication data. It will be filled with the result of the algorithm.
    keyBuffer,:Optional buffer for usage in key calculations. If NULL a buffer will be allocated per function call. size - AES_PRIV_SIZE
    ncMsgBufferOptional buffer for the message encryption which is not done in place. If NULL a buffer will be allocated per function call. size: message size.
typedef NQ_BOOL(* CMAbstractGcmDecryption)(const CMBlob *key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, const NQ_BYTE *auth, NQ_BYTE *keyBuffer, NQ_BYTE *msgBuffer)

This function prototype designates an abstract cryptographic algorithm for both decryption and authentication (GCM). It is used to replace internal NQ encryption with an external one.

This algorithm assumes that there are two blocks of data:

  1. A prefix that is preserved as is
  2. The messages itself that is to be encrypted The authentication is a production of both blocks.
    Parameters
    keyPointer to the encryption key descriptor. Some algorithms do not use this value.
    key1Pointer to the auxiliary key descriptor. This value may be NULL. Also the data pointer may be null as well as the blob length may be zero. In either of those cases the auxiliary key is ignored. Some algorithms may ignore this value anyway.
    prefixA pointer to the message prefix descriptor. This data participate in authentication but remains as is, without encryption.
    messagePointer to the message descriptor. This message will be encrypted in-place.
    authPointer to the authentication data. This value is be used to authenticate.
    keyBuffer,:Optional buffer for usage in key calculations. If NULL a buffer will be allocated per function call. size - AES_PRIV_SIZE
    msgBuffer,:Optional buffer for the message decryption which is not done in place. If NULL a buffer will be allocated per function call. Size - message size.
    Returns
    TRUE if authenticated, FALSE if not.

Function Documentation

void cmSetExternalCrypters ( const CMCrypterList crypters)

This function replaces internal NQ cryptographic algorithms with external ones.

Parameters
cryptersA pointer to the list of internal ciphers. Only non-NULL values are applied.
void cmResetExternalCrypters ( void  )

This function reverts the list of cryptographic algorithms to internal algorithms only.